package com.dld.protocol.json;

import java.io.ByteArrayInputStream;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;

import org.w3c.dom.Element;
import org.w3c.dom.Node;

import com.dld.android.util.ReflectionFactory;

public class ShopCouponDetail {
	private String shopid;
	private String shopname;
	private String logo;
	private String address;
	private String shop_description;
	private String x;
	private String y;
	private String tel;
	private String disid;
	private String preview_image;
	private String rank;
	private String discount_lowest;
	private String short_description;

	public String getRank() {
		return rank;
	}

	public void setRank(String rank) {
		this.rank = rank;
	}

	public String getDiscount_lowest() {
		return discount_lowest;
	}

	public void setDiscount_lowest(String discount_lowest) {
		this.discount_lowest = discount_lowest;
	}

	public String getShort_description() {
		return short_description;
	}

	public void setShort_description(String short_description) {
		this.short_description = short_description;
	}

	public String getPreview_image() {
		return preview_image;
	}

	public void setPreview_image(String preview_image) {
		this.preview_image = preview_image;
	}

	public String getDisid() {
		return disid;
	}

	public void setDisid(String disid) {
		this.disid = disid;
	}

	public String getShopid() {
		return shopid;
	}

	public void setShopid(String shopid) {
		this.shopid = shopid;
	}

	public String getShopname() {
		return shopname;
	}

	public void setShopname(String shopname) {
		this.shopname = shopname;
	}

	public String getLogo() {
		return logo;
	}

	public void setLogo(String logo) {
		this.logo = logo;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getShop_description() {
		return shop_description;
	}

	public void setShop_description(String shop_description) {
		this.shop_description = shop_description;
	}

	public String getX() {
		return x;
	}

	public void setX(String x) {
		this.x = x;
	}

	public String getY() {
		return y;
	}

	public void setY(String y) {
		this.y = y;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public static ShopCouponDetail fromString(String content)
			throws FactoryConfigurationError, Exception {
		ShopCouponDetail sd = new ShopCouponDetail();
		Element root = DocumentBuilderFactory.newInstance()
				.newDocumentBuilder().parse(
						new ByteArrayInputStream(content.getBytes()))
				.getDocumentElement();
		Node result = root.getElementsByTagName("result").item(0);
		sd = ReflectionFactory.create(result, ShopCouponDetail.class);
		return sd;
	}
}